﻿XIncludeFile "ImageWind.pb"
XIncludeFile "ImageButton.pb"
XIncludeFile "ImageLabel.pb"
XIncludeFile "ImageImage.pb"


;  #PB_MessageRequester_YesNo       : Um die 'Yes' (JA) oder 'No' (Nein) Schalter zu erhalten
;   #PB_MessageRequester_YesNoCancel : Um die 'Yes' (JA), 'No' (Nein) und 'Cancel' (Abbruch) Schalter zu erhalten
;   #PB_MessageRequester_Ok          
  
Procedure GdigMsgBox(Hwnd,Titel$, Text.s ,Flags = #PB_MessageRequester_Ok )
;   For I = 1  To  CountString(Text ,Chr(10)) + 1
;     TextTmep.s= StringField(Text,I,Chr(10))
;     Lenght = StringByteLength(TextTmep,#PB_Ascii)
;     Repeat
;       DText.s + PeekS(@TextTmep + DLen  ,6,#PB_Unicode) + Chr(10)
;       DLen + 6
;     Until  Lenght -DLen <0 
;     
;   Next 
; 
;  Lenght = StringByteLength(Text,#PB_Ascii)

  Hwnd=GdipOpenWindow(0,0,0,240,110,Titel$,#Visible | #Enabled |#Gdip_Window_NoMax |#Gdip_Window_NoMin ,#PB_Window_ScreenCentered ,Hwnd)
;   Style = GetWindowLong_(hWnd,#GWL_STYLE)
;   Style & ~#WS_CHILD
;   Style | #WS_POPUP
;   SetWindowLong_(hWnd,#GWL_STYLE,Style);   

  GdipCreateLabel(Hwnd,30,50,230,30,Text)
  GdipCreateButton(Hwnd,0,80,90,80,25,"确 定")
  GdipShowWindow(Hwnd)

  Repeat
  WaitEvent=WaitWindowEvent()
  
  Im_Event = ImWndEvent()
  Im_Window = ImEventHwnd()
  Im_Gadget =ImEventGadget()
  Im_Type =ImEventType()

  If Im_Event
    If Im_Window= Hwnd
      If Im_Gadget=gExit And Im_Type= #PB_EventType_LeftClick
        CloseWindow=1
        
      ElseIf Im_Gadget =gOK  And Im_Type= #PB_EventType_LeftClick

      EndIf 
      
    EndIf 
  EndIf 
  
  If PeekL(Hwnd+SizeOf(PWnd))=EventWindow() And WaitEvent=#PB_Event_CloseWindow
     CloseWindow=1
  EndIf 
Until CloseWindow
GdipCloseWindow(Hwnd)
EndProcedure
 
; IDE Options = PureBasic 4.30 (Windows - x86)
; CursorPosition = 28
; FirstLine = 3
; Folding = -
; EnableAsm
; EnableUnicode
; EnableXP
; HideErrorLog